<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
</html>
<script>
	//用户输入一个数字n
	
	var n = parseInt(prompt('请输入一个正整数'));

	//利用遍历（循环）
	var sum = 0;
	for(var i = 2; i <= n; i++){
		sum += (i + 1) / i;
	};
	console.log(sum);
</script>
